package com.example.common.config;

import com.baidu.aip.speech.AipSpeech;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class BaiduAIConfig {

    @Value("${baidu.ai.appId}")
    private String appId;

    @Value("${baidu.ai.apiKey}")
    private String apiKey;

    @Value("${baidu.ai.secretKey}")
    private String secretKey;

    @Bean
    public AipSpeech aipSpeech() {
        AipSpeech client = new AipSpeech(appId, apiKey, secretKey);
        // 可选：设置连接超时参数
        client.setConnectionTimeoutInMillis(2000);
        client.setSocketTimeoutInMillis(60000);
        return client;
    }
}
